package com.delivery.mapper;

import com.delivery.anno.AutoFill;
import com.delivery.dto.SetmealPageQueryDTO;
import com.delivery.entity.Setmeal;
import com.delivery.enumeration.OperationType;
import com.delivery.vo.SetmealVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface SetmealMapper {

    Integer countRecordsByCategoryId(Long id);

    @AutoFill(OperationType.INSERT)
    void insert(Setmeal setmeal);

    /**
     * 根据ID查询套餐 联表查询套餐下的菜品 setmeal_dish关系表
     * @param id
     * @return
     */
    SetmealVO selectById(Long id);

    /**
     * 分页查询
     * @param dto 查询条件
     * @return
     */
    Page<SetmealVO> page(SetmealPageQueryDTO dto);

    /**
     * 修改套餐
     * @param setmeal
     */
    @AutoFill(OperationType.UPDATE)
    void update(Setmeal setmeal);


    /**
     * 批量删除套餐
     * @param ids
     */
    void deleteBatchById(List<Long> ids);

    /**
     * 根据分类ID查询套餐
     * @param categoryId
     * @return
     */
    List<Setmeal> selectCombosByCategoryId(Long categoryId);
}
